home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 386 / a68 / as68help.doc < prev    next >
Text File  |  1985-11-19  |  10KB  |  178 lines

  1.  
  2. AS68 Helper
  3.  
  4. A SPECIAL INCLUSION LISTING ON DISK AND ON DELPHI ATARI USERS' GROUP
  5.  
  6. A tutorial and utility program for users of DRI's AS68 assembler.
  7.  
  8. by Charles F. Johnson
  9.  
  10.  
  11.  This article won't teach you 68000 assembly language, but it will show you how
  12. to set up a disk with all the files necessary to edit, assemble and debug
  13. programs using DRI's AS68 assembler, as supplied with the Atari Developer's
  14. Kit.  And there's a nice treat included for anyone who uses AS68; a utility
  15. program that can greatly simplify the whole editing and compiling process.
  16. This utility, the AS68 Helper, acts as a sort of dispatcher program, letting
  17. you edit, assemble (with several different options), or debug your code--all
  18. with the click of a mouse button!
  19.  
  20.  The process of editing and compiling an assembly language program on the ST is
  21. nowhere near as straightforward as on the Atari 8-bit models.  If you're used
  22. to the speed and (relative) simplicity of MAC/65 by OSS (to name one excellent
  23. 8-bit assembler), the complexity of the AS68 package can be very discouraging.
  24. With MAC/65 and most 8-bit assemblers, the editor, assembler and debugger
  25. programs are all resident in memory at once.  On the ST, you'll need at least
  26. ten programs (all disk resident) to develop a program.  But cheer up; C
  27. programmers are even worse off in this respect.
  28.  
  29.  In any case, the most important tool for anyone using the AS68 assembler is a
  30. RAMdisk, which sets aside part of the computer's memory to simulate a floppy
  31. disk drive.  You can drastically speed up the assembly process by copying all
  32. the necessary files to the RAMdisk and doing your work from there.  There are
  33. many commercial and public domain RAMdisk programs out for the ST; if you don't
  34. have one yet, there are several on the ANALOG Computing/ST-Log Atari Users'
  35. Group on Delphi.  And many of the public domain versions are just as good as
  36. (in some cases, better than) the ones you pay for.
  37.  
  38.  A RAMdisk is not absolutely necessary to use AS68; you can, of course,
  39. assemble just as well from a normal disk drive.  But it will definitely make
  40. your life easier!  Just remember to copy your source files to a real disk
  41. before turning off the computer and sending your RAMdisk to bit heaven.
  42.  
  43.  I'll assume you're using the MicroEMACS text editor that comes with the
  44. Developer's Kit, but if you prefer a different editor, just substitute its name
  45. for EMACS.TTP in the discussion that follows.  Please note that whichever
  46. editor you use, you must save source code with a filename extension of .S--the
  47. AS68 assembler doesn't accept others.
  48.  
  49.  The files you'll need from the Developer's Kit disks are:
  50.  
  51.  BATCH.TTP......The batch file processor (uses AS.BAT, see below)
  52.  EMACS.TTP......Text editor
  53.  SID.TTP........DRI's symbolic debugger
  54.  AS68.PRG.......The assembler
  55.  AS68SYMB.DAT...A data file which is read by the assembler
  56.  LINK68.PRG.....The linker
  57.  RELMOD.PRG.....The relocator; creates a relocatable .PRG file
  58.  RM.PRG.........File deleter to remove intermediate files
  59.  WAIT.PRG.......Waits for a keypress after assembly
  60.  
  61.  In addition to these files, you also need to create a file called AS.BAT (you
  62. can call it anything, actually, but the extension must always be .BAT).  This
  63. file contains the commands for BATCH.TTP, which is the program you double-click
  64. on to begin an assembly; it reads the AS.BAT file and executes the list of
  65. commands contained therein.  To perform a simple assembly, with no listing or
  66. symbol table, you should enter the following text into your editor:
  67.  
  68.     as68 -l -u %1.s
  69.     link68 [u] %1.68k=1.o
  70.     relmod %1.68k %1.prg
  71.     rm %1.68k
  72.     rm %1.o
  73.     wait
  74.  
  75.  Save this with the name AS.BAT; you now have a complete assembler disk.  Copy
  76. these ten files, plus your source code, to your RAMdisk.  When you've finished
  77. editing the source code for a program, save it and double-click on BATCH.TTP.
  78. A GEM dialog box appears to allow you to enter parameters for BATCH; enter the
  79. following text:
  80.  
  81.     as source
  82.  
  83. You would replace source with the name of your source code file.  Please note
  84. that you should omit the .S extension or the assembler may delete your source
  85. code; so be careful!  Press RETURN or click on the OK button, and the assembly
  86. will begin.  As BATCH calls the programs, the screen will show which one is
  87. currently active.  Any errors will be printed, and, finally, you should see a
  88. message telling you to press RETURN.  When you do, you'll be back at the GEM
  89. desktop, and a file with the same name as your source code but an extension of
  90. .PRG will now be present on the disk (or RAMdisk, as the case may be).  This
  91. is, of course, your assembled program, which may be run like any other GEM
  92. program, or inspected and debugged with the SID debugger.  (See the Developer's
  93. Kit documentation for more details on the operation of SID.)
  94.  
  95.  
  96. And now...AS68 Helper!
  97.  
  98.  AS68 Helper is a utility that can greatly speed up the assembly process.  To
  99. install it, you should click once on the file called ASM_EDIT.PRG (included on
  100. this month's ST-Log disk and on our Atari Users' Group on Delphi), and then
  101. move up to the options menu heading on the desktop and select INSTALL
  102. APPLICATION.  For the document type, enter S and click on the OK button (don't
  103. press RETURN...the default in this dialog box is CANCEL).  Now, whenever you
  104. double-click on a file with an extension of .S (a source code file), AS68
  105. Helper will load first and present you with a GEM menu bar with two titles,
  106. "Desk" and "File." Note: you don't have to go through the INSTALL APPLICATION
  107. procedure every time.  Just do it once and save your desktop.
  108.  
  109.  The menus work in typical GEM fashion:  just move the mouse to one of the
  110. titles, and a box will drop down containing several choices.  If you don't want
  111. to use the mouse, you can simply type the first letter of any menu selection
  112. while there are no menus pulled down (e.g.  E for Edit, A for Assemble, etc.)
  113. The desk menu allows you to access any desk accessories you have installed, and
  114. also lets you view the AS68 Helper title box.  The file menu lets you edit,
  115. assemble, or debug your program--AS68 Helper uses the GEMDOS EXEC function to
  116. call EMACS.TTP, BATCH.  TTP, or SID.PRG.  These programs, along with the others
  117. mentioned above (including ASM_EDIT.PRG) must all be present in the same
  118. directory with the source code (they're already on the RAMdisk anyway, right?)
  119. If there is no .PRG file on the disk with the same name as the source, the
  120. DEBUG option will appear in lighter type, to show that it is not currently
  121. accessible.
  122.  
  123.  The "Print" option lets you send the source file you're working on to any type
  124. of printer.  A dialog box allows you to choose pica, emphasized, elite,
  125. condensed, or nearletter-quality type, set your left margins, and skip over the
  126. paper's perforations.  (These print options only work with Epson/Star and
  127. compatible printers.) There is also an option to expand tabs to any number of
  128. spaces (the default is 8); note that the tab space setting works for any
  129. printer, not just the Epson clan, since it expands TAB characters to strings of
  130. spaces.  After starting a printout, you can abort it by pressing any key.
  131.  
  132.  The file menu also lets you select a different source file to work on.  Choose
  133. "New Source File" and a "File Selector" box will appear, showing all files with
  134. an extension of .S in the current directory.  Since all the assembler programs
  135. must be in the same directory as your source code, you may not change
  136. directories with the File Selector.  If you try, you'll see an alert box with
  137. the message Source and assembler files must be in the directory you started
  138. with...To edit several different source files during a session, just copy them
  139. all to the same directory.
  140.  
  141.  When you select "Assemble," another dialog box will let you choose from
  142. several assembly options.  You can specify the extension of the output file
  143. (.PRG, .ACC, .TOS, or .TTP) and choose from three preset types of assembly--a
  144. simple assembly, an assembly which produces a listing file with extension of
  145. .ASM, or an assembly which includes in the .PRG file the actual labels used in
  146. your source (this is called a "symbol table").  When a .PRG file with symbol
  147. table is examined with SID, you can refer to the same labels as the ones you
  148. used in your source code, which greatly facilitates debugging.  In addition to
  149. these preset types, you can also choose "Batch File" (see below) to customize
  150. the assembly.  (Batch files must be in the same directory as all the other
  151. files.) By the way, when you use AS68 Helper, you can eliminate WAIT.PRG from
  152. your assembler disk.  If you use a preset assembly type, you can eliminate
  153. RM.PRG, too.
  154.  
  155.  The key to producing these different types of assemblies is in creating the
  156. proper .BAT file for BATCH.TTP.  AS68 Helper writes a new AS.BAT file to the
  157. disk every time you assemble, based on your choice.  The source code file on
  158. the ST-Log disk and Atari Users' Group is called ASMEDIT.S.  There you can see
  159. how these batch files should look.  Bear in mind that there are many more
  160. possibilities for customizing batch files.  The three choices that AS68 Helper
  161. gives you are not your only options!
  162.  
  163.  The source code also shows how to include object trees directly into an
  164. assembly language program, instead of using a separate resource file created by
  165. the GEM Resource Construction Set, as well as a number of other interesting
  166. techniques.  I would like to extend special thanks to my friend Barnaby Finch,
  167. who provided much of the information about setting up an assembler disk.
  168.  
  169.  A final note on using different editors:  you have two options if you want to
  170. use AS68 Helper with an editor other than MicroEMACS.  You can simply rename
  171. your editor EMACS.TTP (this works in most cases, unless the text editor is
  172. GEM-based, like 1st Word), or edit the source code for AS68 Helper to use the
  173. new name.  If you choose the latter, you'll probably have to adjust some loops
  174. and some counters, as well as the obvious filename specifiers.  The source is
  175. pretty well commented and should be fairly easy to follow.  Have fun...and may
  176. all your assemblies be error-free!
  177.  
  178. ə